<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="__MODES__/assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__CSS__/style.css" />
		<link href="__MODES__/assets/css/codemirror.css" rel="stylesheet">
		<link rel="stylesheet" href="__MODES__/assets/css/ace.min.css" />
		<link rel="stylesheet" href="__MODES__/assets/css/font-awesome.min.css" />
		<!--[if IE 7]>
		  <link rel="stylesheet" href="__MODES__/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="__MODES__/assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="__MODES__/assets/js/jquery.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
		<![endif]-->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='__MODES__/assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
		<script type="text/javascript">
		 window.jQuery || document.write("<script src='__MODES__/assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
		</script>
		<![endif]-->
		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='__MODES__/assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
		</script>
		<script src="__MODES__/assets/js/bootstrap.min.js"></script>
		<script src="__MODES__/assets/js/typeahead-bs2.min.js"></script>
		<!-- page specific plugin scripts -->
		<script type="text/javascript" src="__JS__/H-ui.js"></script>
		<script type="text/javascript" src="__JS__/H-ui.admin.js"></script>
		
		<script  src="__PLUGINS__/layer/layer.js"></script>
	    <script  src="__PLUGINS__/common.js"></script>
      <script>
 layer.config({
	extend: 'extend/layer.ext.js'
 });
</script>
		<title>用户列表</title>
	</head>

	<body>
		<div class="page-content clearfix">
			<div id="Member_Ratings">
				<div class="d_Confirm_Order_style">
					<div class="search_style">

						<ul class="search_content clearfix">
							<li><label class="l_f">会员名称</label><input name="keywords" id="keywords" type="text" class="text_add" placeholder="输入会员名称、电话、邮箱" style=" width:400px" /></li>
							<li>
                              <label class="l_f">用户实名状态：</label>
                              <select name="benefit_type" id='reals'>
                                <option value="">请选择</option>
                                <option value="1" {if isset($getdata['reals'])}{$getdata['reals']=='1'? 'selected':''}{/if}>已实名</option>
                                <option value="2" {if isset($getdata['reals'])}{$getdata['reals']=='2'? 'selected':''}{/if}>未实名</option>
                              </select>
                          </li>
                          	<li>
                              <label class="l_f">用户等级：</label>
                              <select name="benefit_type" id='user_type_id'>
                                <option value>请选择</option>
                                {volist name='userTypelist' id='vs'}
                                	<option value="{$vs.typeid}" {if isset($getdata['user_type_id'])}{$getdata['user_type_id']==$vs.typeid? 'selected':''}{/if}>{$vs.typeName}</option>
                                {/volist}
                              </select>
                            </li>
                          	<li style="width:90px;"><button type="button" id="search" class="btn_search"><i class="icon-search"></i>查询</button></li>
							<li style="width:90px;"><button type="button" id="searchAout" class="btn_search"><i class="icon-search"></i>全部</button></li>
						</ul>

						<div><a title="添加" href="javascript:;" onclick="add()" class="btn btn-xs btn-success">添加</a></div>

					</div>
					<!---->
                  <div class="transaction_style">
                   <ul class="state-overview clearfix">
                    {volist name='userTypelist' id='utl'} 
                        <li class="Info">
                         <span class="symbol red"><i class="icon-user bigger-120"></i></span>
                         <span class="value"><h4>{$utl.typeName}</h4><p class="Quantity color_red">{$utl.typeCount}</p></span>
                        </li>
                    {/volist}
                   </ul>
                 </div>
					<div class="table_menu_list">
						<table class="table table-striped table-bordered table-hover" >
							<thead>
								<tr>
									<th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
									<th width="50">ID</th>
									<th width="80">用户姓名</th>
									<th width="100">登陆账号</th>
                                  <th width="50">余额</th>
									<th width="100">手机</th>
									<th width="150">身份证</th>
									<th>端</th>
									<th width="180">加入时间</th>
									<th width="100">等级</th>
									<th>推荐码</th>
									<th>推荐人</th>
									<th>代理商</th>
									<th width="70">状态</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								{volist name='list' id='v' }
									<tr>
										<td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
										<td>{$v.user_id}</td>
										<td><u style="cursor:pointer" class="text-primary" onclick="member_show({$v.user_id})">{$v.user_name}</u></td>
										<td>{$v.user_account}</td>
                                       <td>{$v.user_moeny}</td>
										<td>{$v.user_phone}</td>
										<td>{$v.user_idcard}</td>
										<td><a title="编辑"   onclick="user_datainfo('{$v['user_id']}')" href="javascript:;" >{$v.user_isapp==2?'网页':'APP'}</a></td>
										<td>{$v.user_time|date='Y-m-d H:i:s'}</td>
										<td>{$v.user_type_id|getUserType}</td> 
										<td>{$v.user_code}</td>
										<td>{$v.user_pid|getUser='user_account'}</td> 
										<td>{$v.user_agent_id|getAgent='agent_account'}</td>
										<td class="td-status"><span  data-url="{:Url('Admin/User/updestate')}?id={$v['user_id']}" data-confirm="您确认{$v['user_state']==1?'冻结解除冻结':'冻结'}吗？"  class=" link-confirm label label-{$v['user_state']==1?'danger':'success'}  radius">{$v['user_state']==1?'冻结':'正常'}</span></td>
										<td class="td-manage">
                                            <a title="修改会员金额"   onclick="money_edit('{$v['user_id']}')" href="javascript:;" class="btn btn-xs btn-info"><i class="icon-cny  bigger-120"></i></a>
											<a href="javascript:;" title="重置登陆密码" data-url="{:Url('Admin/User/resets')}?id={$v['user_id']}" data-confirm="您确认要重置登陆密码吗？"  class="link-confirm btn btn-xs btn-success"><i class="icon-lock bigger-120"></i></a>
											<a title="查看会员银行卡"   href="{:Url('Admin/Userbank/index')}?bid={$v['user_id']}" class="btn btn-xs btn-info"><i class="icon-list bigger-120"></i></a>
											<a title="修改会员资料"   onclick="member_edit('{$v['user_id']}')" href="javascript:;" class="btn btn-xs btn-info"><i class="icon-edit bigger-120"></i></a>
											<a title="查看下级"  href="{:Url('Admin/User/index')}?pid={$v['user_id']}" class="btn btn-xs btn-info"><i class="icon-user  bigger-120"></i></a>
											<a title="调整会员等级" href="javascript:;" onclick="upgrade('{$v['user_id']}')" class="btn btn-xs btn-warning">调整会员等级</a>
											<a title="查看费率" href="{:Url('Admin/Userrate/index')}?id={$v.user_id}" class="btn btn-xs btn-info">查看费率</a>
											<a title="资金变动记录" href="{:Url('Admin/User/capchange')}?id={$v.user_id}" class="btn btn-xs btn-info">资金变动记录</a>
                                      	</td>
									</tr>
								{/volist}
							</tbody>
						</table>
					</div>
					<div>
		                {$list->render()|raw}
		            </div>
				</div>
			</div>
		</div>
		<!--添加用户图层-->
		
	</body>

</html>
<script>
	jQuery(function($) {
		
		$('#search').on('click', function() {
			var text = $('#keywords').val();
			var real = $('#reals').val();
			var user_type_id = $('#user_type_id').val();
			window.location.href = "{:Url('Admin/user/index')}?keywords="+text+"&reals="+real+'&user_type_id='+user_type_id; 
		});
		
		$('#searchAout').on('click', function() {
			window.location.href = "{:Url('Admin/user/index')}"; 
		});
		
		$('table th input:checkbox').on('click', function() {
			var that = this;
			$(this).closest('table').find('tr > td:first-child input:checkbox')
				.each(function() {
					this.checked = that.checked;
					$(this).closest('tr').toggleClass('selected');
				});

		});

		$('[data-rel="tooltip"]').tooltip({
			placement: tooltip_placement
		});

		function tooltip_placement(context, source) {
			var $source = $(source);
			var $parent = $source.closest('table')
			var off1 = $parent.offset();
			var w1 = $parent.width();

			var off2 = $source.offset();
			var w2 = $source.width();

			if(parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
			return 'left';
		}
	})
	
	/*用户-查看*/
	function member_show(id) {
		layer.open({
		  type: 2,
		  title: false,
		  closeBtn: 1,
		  area: ['500px', '400px'],
		  shadeClose: true,
		  skin: 'yourclass',
		  content: '{:Url('Admin/User/info')}?id='+id
		});
	}
	function member_edit(id){
		parent.layer.open({
			type: 2,
			title: false,
			closeBtn: 1,
		  	area: ['80%', '80%'],
			shadeClose: true,
			skin: 'yourclass',
			content: '{:Url('Admin/User/uedit')}?id='+id,
			end: function () {
                location.reload();
            }
		});
	}
	function money_edit(id){
		layer.prompt({title: '请输入增减金额-为减', formType: 0}, function(pass, index){
			var url = "{:Url('/Admin/User/upmoeny')}";
			ajaxPost(url,$("#bank-btn"),{id:id,money:pass},function (r) {
				$("#bank-btn").removeAttr('disabled');
				window.location.reload();
			})
		});
	}
	function upgrade (id) {
		parent.layer.open({
			type: 2,
			title: false,
			closeBtn: 1,
			area: ['700px', '600px'],
			shadeClose: true,
			skin: 'yourclass',
			content: '{:Url('Admin/Upgrade/upgrade')}?uid='+id,
		});
	}
	/*用户-查看注册数据*/
	function user_datainfo(id) {
		layer.open({
		  type: 2,
		  title: false,
		  closeBtn: 1,
		  area: ['500px', '400px'],
		  shadeClose: true,
		  skin: 'yourclass',
		  content: '{:Url('Admin/User/datainfo')}?id='+id
		});
	}
	function add() {
		layer.open({
		  type: 2,
		  title: false,
		  closeBtn: 1,
		  area: ['80%', '80%'],
		  shadeClose: true,
		  skin: 'yourclass',
		  content: "{:Url('add')}"
		});
	}
</script>